package com.wpml.ware.controller;

import com.wpml.common.util.PageUtils;
import com.wpml.common.util.ResultJson;
import com.wpml.ware.entity.WareOrderTaskDetailModel;
import com.wpml.ware.service.WareOrderTaskDetailService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;


/**
 * 库存工作单
 *
 * @author leifengyang
 * @email leifengyang@gmail.com
 * @date 2019-10-08 09:59:40
 */
@RestController
@RequestMapping("ware/wareordertaskdetail")
public class WareOrderTaskDetailController {
    @Resource
    private WareOrderTaskDetailService wareOrderTaskDetailService;

    /**
     * 列表
     */
    @GetMapping("/list")
    //@RequiresPermissions("ware:wareordertaskdetail:list")
    public ResultJson list(@RequestParam Map<String, Object> params){
        PageUtils page = wareOrderTaskDetailService.queryPage(params);

        return ResultJson.ok(page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("ware:wareordertaskdetail:info")
    public ResultJson info(@PathVariable("id") Long id){
        WareOrderTaskDetailModel wareOrderTaskDetail = wareOrderTaskDetailService.getById(id);

        return ResultJson.ok(wareOrderTaskDetail);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //@RequiresPermissions("ware:wareordertaskdetail:save")
    public ResultJson save(@RequestBody WareOrderTaskDetailModel wareOrderTaskDetail){
		wareOrderTaskDetailService.save(wareOrderTaskDetail);

        return ResultJson.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //@RequiresPermissions("ware:wareordertaskdetail:update")
    public ResultJson update(@RequestBody WareOrderTaskDetailModel wareOrderTaskDetail){
		wareOrderTaskDetailService.updateById(wareOrderTaskDetail);

        return ResultJson.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //@RequiresPermissions("ware:wareordertaskdetail:delete")
    public ResultJson delete(@RequestBody Long[] ids){
		wareOrderTaskDetailService.removeByIds(Arrays.asList(ids));

        return ResultJson.ok();
    }

}
